﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;

namespace NuaTarDoneng
{
    public partial class Message : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            pageset.setMeta("留言板", "欢迎大家留言", this);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection cnn = new SqlConnection(ConfigurationManager.AppSettings["constr"]);
            SqlCommand cmd = cnn.CreateCommand();
            string id = Guid.NewGuid().ToString("N");
            cmd.CommandText = "insert into [Message] (tagID,name,Message,website,Email,CreatDate) values('"+id+"','"+bigname.Text+"','"+bigmessage.Text+"','"+bigweb.Text+"','"+bigemail.Text+"','"+DateTime.Now+"')";
            cnn.Open();
            if (cmd.ExecuteNonQuery() == 1)
            {
                
                Response.Redirect(Request.Url.ToString());
            }
            cnn.Close();
        }
    }
}